<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<script>
		function Parent() { }
		// 将要继承的属性赋给prototype属性
		Parent.prototype.money = 100000
		Parent.prototype.head = 1

		function Child(name, age) {
			this.name = name
			this.age = age
		}
		// 直接继承父类prototype属性 省去new对象节省内存
		// 还是会继承链紊乱
		Child.prototype = Parent.prototype
		var son = new Child('jiffy', 22)
		// 手动拨正
		Child.prototype.constructor = Child
		// 新问题，因为手动拨正的原因，父类构造函数变成子类的了
		alert(Child.prototype.constructor)
		alert(Parent.prototype.constructor)
		alert(son.name)
		alert(son.age)
		alert(son.money)
		alert(son.head)

	</script>
</body>

</html>